/*
 * Copyright (c) 2018-2999 九五云信息科技有限公司 All rights reserved.
 *
 * https://www.gz-yami.com/
 *
 * 未经允许，不可做商业用途！
 *
 * 版权所有，侵权必究！
 */

package com.yami.shop.coupon.comment.dao;

import java.util.Date;
import java.util.List;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yami.shop.bean.param.CustomerReqParam;
import com.yami.shop.bean.param.MemberReqParam;
import com.yami.shop.bean.param.ProdEffectParam;
import com.yami.shop.common.util.PageParam;
import com.yami.shop.coupon.comment.model.CouponUser;
import org.apache.ibatis.annotations.Param;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

public interface CouponUserMapper extends BaseMapper<CouponUser> {

    List<CouponUser> getCouponAndCouponUserByUserId(@Param("userId") String userId);

    List<CouponUser> getCouponAndCouponUserByCouponUserIds(@Param("couponUserIds") List<Long> couponUserIds);

    void deleteUnValidTimeCoupons(@Param("date") Date date);

    void updateStatusByTime(@Param("now") Date now);

    void deleteUserCoupon(@Param("userId") String userId, @Param("couponId") Long couponId);

    void updateUseStatusByCouponUserId(@Param("status") Integer status, @Param("couponUserId") Long couponUserId);

    void batchUpdateUserCouponStatus(@Param("status") int status, @Param("couponUserIds") List<Long> couponUserIds);

    void updateStatusByOrderNumber(@Param("status") int status, @Param("orderNumber") String orderNumber);

    Integer countTakeNum(@Param("couponId") Long couponId, @Param("status") Integer status, @Param("param") ProdEffectParam param);

    Integer countMemberGetCoupon(@Param("param") CustomerReqParam param);

    Integer countMemberCouponByParam(@Param("param") MemberReqParam param);

    Integer countCouponUsableNums(@Param("userId") String userId, @Param("date") Date date);

    Integer countCouponUsedNums(@Param("userId") String userId);

    Integer countCouponExpiredNums(@Param("userId") String userId);

    IPage<CouponUser> getPageByUserId(PageParam<CouponUser> page, @Param("userId") String userId, @Param("status") Integer status);
}
